package day2;

/**
 * @author oldliu
 * @since 1.0
 */
public class IntTest3 {
    public static void main(String[] args) {
        int a=14,b=22;
        int c1=a&b;//6
        int c2=a|b;//30
        int c3=~b;//取反，-23
        System.out.println(a^b);//异或
        System.out.printf("c1=%d,c2=%d,C3=%d\n",c1,c2,c3);
        System.out.println(">>>>>>>>>>>>>>>>>>>>");
        int d1=b>>2;//除2的2次方
        int d2=b<<2;//乘4
        int d3=c3>>2;//-6
        int d4=c3>>>2;//无符号右移，最高位补0
        System.out.printf("d1=%d,d2=%d,d3=%d，d4=%d\n",d1,d2,d3,d4);
        System.out.println(c3/4);//和移位操作不完全相同
    }
}
